﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace Dormsystem
{
    public partial class Main : Form
    {
        public Main()
        {
            InitializeComponent();
        }

        private void tsmiExit_Click(object sender, EventArgs e)
        {
            if (MessageBox.Show("你是否要退出系统？", "退出系统", MessageBoxButtons.YesNo) == DialogResult.Yes)
            {
                this.Close();
            }
        }

        private void tsbtnExit_Click(object sender, EventArgs e)
        {
            if (MessageBox.Show("你是否要退出系统？", "退出系统", MessageBoxButtons.YesNo) == DialogResult.Yes)
            {
                this.Close();
            }
        }

        private void Main_FormClosing(object sender, FormClosingEventArgs e)
        {
            //if (MessageBox.Show("你是否要退出系统？", "退出系统", MessageBoxButtons.YesNo) == DialogResult.No)
            //{
            //    e.Cancel = true;
            //}
        }

        private void tsmiUserList_Click(object sender, EventArgs e)
        {
            OpenListWindow();
        }

        private void tsbtnUserList_Click(object sender, EventArgs e)
        {
            OpenListWindow();
        }

        private void OpenListWindow()
        {
            UserList userlist = new UserList();
            userlist.MdiParent = this;
            userlist.Show();
        }

        private void tsbtnAddUser_Click(object sender, EventArgs e)
        {
            OpenAddUser();
        }

        private void tsmiAddUser_Click(object sender, EventArgs e)
        {
            OpenAddUser();
        }

        private void OpenAddUser()
        {
            AddUser addUser = new AddUser();
            addUser.MdiParent = this;
            addUser.Show();
        }

        private void tsbtnAddStudent_Click(object sender, EventArgs e)
        {
            OpenAddStudent();
        }

        private void tsmiAddStudent_Click(object sender, EventArgs e)
        {
            OpenAddStudent();
        }

        private void OpenAddStudent()
        {
            AddStudent addStudent = new AddStudent();
            addStudent.MdiParent = this;
            addStudent.Show();
        }
    }
}
